<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>车辆信息管理</title>
    <link href="__STATIC__/css/swiper.min.css" rel="stylesheet">
    <link href="/html/layui/css/layui.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="/html/css/base.css">
    <style>
        .positiveImg {
            width: 50%;
            height: 290px;
        }
        .reverseImg{
            width: 50%;
            height: 290px;
        }
    </style>
</head>


<script type="text/javascript">
    //全局变量
    var GV = {
        ROOT: "__ROOT__/",
        WEB_ROOT: "__WEB_ROOT__/",
        JS_ROOT: "static/js/",
        APP: '{$Request.module}'/*当前应用名*/
    };
</script>
<script src="__STATIC__/js/wind.js"></script>
<!-- HTML5 shim for IE8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<![endif]-->


<link href="/themes/admin_simpleboot3/public/assets/themes/{:cmf_get_admin_style()}/bootstrap.min.css" rel="stylesheet">
<link href="/themes/admin_simpleboot3/public/assets/simpleboot3/css/simplebootadmin.css" rel="stylesheet">
<link href="__STATIC__/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<!--[if lt IE 9]>
<script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<body>
<div class="activity" id="personHeight">
    <div class="title">
        <ul class="news-title">
            <li class="title-item"><a href="javascript:;">车辆信息</a></li>
        </ul>
    </div>
    <div class="box-cont">
        <div class="act-forenotice">
            <form class="layui-form" action="{:url('portal/admin_index/save_car_info')}" method="post">
                <input type="hidden" name="user_id" value="{$user_id}">
                <div class="layui-form-item">
                    <label class="layui-form-label cpIformation">车牌号:</label>
                    <div class="layui-input-block cpIformationBlock">
                       <input type="text" name="car_card" value="{$car_info.car_card|default=''}" required  lay-verify="required" placeholder="请输入您的车牌号" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <!--<div class="layui-form-item">-->
                    <!--<label class="layui-form-label cpIformation">驾驶证号:</label>-->
                    <!--<div class="layui-input-block cpIformationBlock">-->
                       <!--<input type="text" name="idcard" value="{$car_info.idcard|default=''}" required  lay-verify="required" placeholder="请输入您的驾驶证号" autocomplete="off" class="layui-input">-->
                    <!--</div>-->
                <!--</div>-->

                <div class="layui-form-item bottomSty">
                    <label class="layui-form-label cpIformation">行驶证:</label>
                    <div class="layui-input-block cpIformationBlock">
                        <div class="positiveImg">
                            <a href="javascript:;">
                                <input type="hidden" name="img_a" id="a" value="{$car_info.img_a}">
                                <div class="topImg" style="height: 100%;width: 100%;margin-top: 0">
                                   <img  src="{$car_info.img_a|default='/html/img/scImg.png'}" style="height: 100%;width: 100%;" id="imga">
                                </div>
                                <div>请上传行驶证（正页）</div>
                            </a>
                        </div>
                        <div class="reverseImg">
                            <a href="javascript:;">
                                <input type="hidden" name="img_b" id="b" value="{$car_info.img_b}">
                                <div class="topImg" style="height: 100%;width: 100%;margin-top: 0">
                                  <img src="{$car_info.img_b|default='/html/img/scImg.png'}" id="imgb" style="height: 100%;width: 100%;">
                                </div>
                                <div>请上传行驶证（副页）</div>
                            </a>
                        </div>
                        <div style="clear: both;"></div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block cpIformationBlock colorSty">

                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block qdsc">
                       <button class="layui-btn btnColor btn btn-primary  js-ajax-submit" >确定修改</button>
                    </div>
                    <div style="clear: both;"></div>
                </div>
            </form>
        </div>

    </div>
</div>
</body>
<script src="__STATIC__/js/jquery.min.js"></script>
<script src="__STATIC__/js/swiper.min.js"></script>
<script type="text/javascript" src="/html/js/TweenMax.min.js"></script>
<script type="text/javascript" src="/html/layui/layui.js"></script>
<script type="text/javascript" src="/html/js/base.js"></script>

<script>

    var bootstrapDateTimeInput = $("#datetime");
    if (bootstrapDateTimeInput.length) {
        Wind.css('bootstrapDatetimePicker');
        Wind.use('bootstrapDatetimePicker', function () {
            bootstrapDateTimeInput.datetimepicker({
                minView: "month", //选择日期后，不会再跳转去选择时分秒
                language:  'zh-CN',
                format: 'yyyy-mm-dd',
                todayBtn:  1,
                autoclose: 1,
            });
        });
    }
    layui.use('upload', function(){
        var upload = layui.upload;

        //上传头像
        var uploadInst = upload.render({
            elem: '#test1' //绑定元素
            ,url: '/portal/index/up_picture' //上传接口
            ,done: function(res){
                console.log(res.url);
                $("#img").val(res.url);
                $('#pic').attr('src',res.url);
                //上传完毕回调
            }
            ,error: function(){
                //请求异常回调
            }
        });
        //上传正面
        var uploadInst = upload.render({
            elem: '#imga' //绑定元素
            ,url: '/portal/index/up_picture' //上传接口
            ,done: function(res){
                console.log(res.url);
                $("#a").val(res.url);
                $('#imga').attr('src',res.url);
                //上传完毕回调
            }
            ,error: function(){
                //请求异常回调
            }
        });
        //上传反面
        var uploadInst = upload.render({
            elem: '#imgb' //绑定元素
            ,url: '/portal/index/up_picture' //上传接口
            ,done: function(res){
                console.log(res.url);
                $("#b").val(res.url);
                $('#imgb').attr('src',res.url);
                //上传完毕回调
            }
            ,error: function(){
                //请求异常回调
            }
        });
    });


    $(function () {
        //上面按钮点击事件
        $('#personHeight .title-item').off("click").on("click",function(e){
            e.preventDefault();
            var _index = $(this).index();
            $(this).addClass('active').siblings().removeClass('active');
            $('#personHeight .box-cont .act-forenotice').eq(_index).removeClass("hidden").siblings().addClass("hidden");
            var height_con = $('#personHeight .box-cont .act-forenotice').eq(_index).height()+45;
            $(".personalRight", parent.document).height(height_con);
        });
    });
    //layui
    layui.use(['form','laydate'], function(){
        var form = layui.form
                ,laydate = layui.laydate;
        //时间选择
        laydate.render({
            elem: '#date'
        });
        //监听提交
        form.on('submit(per_data)', function(data){
            $.ajax({
                type: "post",
                url: "/portal/personal/save_user_info",
                data: data.field,
                dataType: "json",
                success: function(res) {
                    console.log(res)
                }
            });
//            layer.msg('报名成功，等待审核', {
//                time: 2000
            });
//            layer.msg(JSON.stringify(data.field));
//            return false;

    });
</script>
</html>